﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace AI.Steering
{
    /// <summary>
    /// 靠近
    /// </summary>
    public class SteeringForSeek : Steering
    {
        [Tooltip("目标物体变换组件")]
        public Transform targetTF;
        public override Vector3 GetForce()
        {
            //期望力 = 目标点 - 自身点
            Vector3 expectForce = (targetTF.position - transform.position).normalized * speed;
            print(expectForce+"------"+ controller.currentForce);
            //实际力 = 期望力 - 当前力
            return (expectForce - controller.currentForce) * weight;//权重越大，实际力到达最大越快
        }
    }
}

